package com.tdam2014.grupo02;

import com.tdam2014.grupo02.R;

//import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;

public class FolderActivity extends ListActivity implements PictureSelectionListener{
	
	public static final String KEY_PICTURE_NAME = "keyName";
	public static final String KEY_PICTURE_ID = "keyID";
	public static final String KEY_LOAD_PICTURE_DATA = "keyLoadPictureData";

	private FolderFragment fragment;
	@Override
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_folder);
		
		fragment = (FolderFragment) getFragmentManager().findFragmentById(R.id.folderFragment);
		fragment.setPictureSelectionListener(this);
		
	}

	@Override
	public void onPictureSelected(Picture picture) {
		
		Intent intent = new Intent(this, PictureActivity.class);
			intent.putExtra(KEY_PICTURE_NAME, picture.getPictureName());
			intent.putExtra(KEY_PICTURE_ID, String.valueOf(picture.getPictureId()));
			intent.putExtra(KEY_LOAD_PICTURE_DATA, Boolean.TRUE);
			startActivity(intent);
		// TODO Auto-generated method stub
		
	}
	
	
}
